<?php
/**
 * Created by PhpStorm.
 * User: venki
 * Date: 2023/11/17
 * Time: 10:34
 */

namespace app\Behaviors;

use app\Events\MyEvent;
use yii\base\Behavior;
use yii\base\Event;
use yii\db\ActiveRecord;

class MyBehavior extends \yii\base\Behavior
{
    const EVENT_HELLO = 'hello';

    public function events(): array
    {
        return [
            MyEvent::EVENT_BEFORE_VALIDATE => 'beforeValidate',
        ];
    }

    public function beforeValidate($event)
    {
        // 处理器方法逻辑
    }
}